﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using Freeform;

namespace Space_in_Shaders
{
    public class SmokePuff : Fader
    {
        public NMotion NMot { get; set; }

        public SmokePuff(SpaceWorld World, Vector2 Position, Vector2 Velocity, Single Variance)
            : base(World, 1200)
        {
            Game.LoadAnimation(this);
            Actor.Depth = 0.8f;
            StartColour = new Color(new Vector4(0.97f, 0.75f, 0.90f, 1));
            //Actor.ColourOverlay = new Color(new Vector4(0.97f, 0.75f, 0.90f, 1));

            SpatialProperties.Size = Vector2.One * Game.Random.Single(0.6f,1.4f);
            SpatialProperties.Position = Position + new Vector2(Game.Random.Single(-Variance, Variance), Game.Random.Single(-Variance, Variance));

            NMot = new NMotion(SpatialProperties);
            NMot.ForceResistance = 0.98f;
            NMot.Velocity = Velocity;
            NMot.Spin = Game.Random.Single(-25, 25);
        }

        public override void Update(GameTime time)
        {
            base.Update(time);

            Remaining -= time.ElapsedGameTime.Milliseconds;
            if (Remaining < 0)
                this.Dispose();
        }
    }
}
